package kr.hyunist.androidcomplete01saeildamil.ch09;

import kr.hyunist.androidcomplete01saeildamil.*;
import android.app.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class ImgChangeEx extends Activity {
	Button top;
	Button bottom;
	ImageView iv1;
	ImageView iv2;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.imgchangeex);

		top = (Button) findViewById(R.id.imgchangebtn1);
		bottom = (Button) findViewById(R.id.imgchangebtn2);
		iv1 = (ImageView) findViewById(R.id.imagechangeiv1);
		iv2 = (ImageView) findViewById(R.id.imagechangeiv2);

		top.setOnClickListener(mOnClickListener);
		bottom.setOnClickListener(mOnClickListener);
	}

	View.OnClickListener mOnClickListener = new View.OnClickListener() {

		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.imgchangebtn1:
				iv1.setVisibility(View.VISIBLE);
				iv2.setVisibility(View.INVISIBLE);
				break;
				
			case R.id.imgchangebtn2:
				iv2.setVisibility(View.VISIBLE);
				iv1.setVisibility(View.INVISIBLE);
				break;
			}
		}

	};
}
